﻿#region Đào Mạnh Hòa
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BusinessLogic
{
    public static class SelectTongHopCongNo
    {
        public static Entities.TraLaiNCC[] TraLaiNCC()
        {
            Entities.TraLaiNCC[] tralaincc = BusinessLogic.TraLaiNCC.Select();
            if (tralaincc == null)
                tralaincc = new Entities.TraLaiNCC[0];
            return tralaincc;
        }

        public static Entities.PhieuTTNCC[] PhieuTTNCC()
        {
            Entities.PhieuTTNCC[] tralaincc = BusinessLogic.PhieuTTNCC.Select();
            if (tralaincc == null)
                tralaincc = new Entities.PhieuTTNCC[0];
            return tralaincc;
        }

        public static Entities.ChiTietPhieuTTNCC[] ChiTietPhieuTTNCC()
        {
            Entities.ChiTietPhieuTTNCC[] tem = BusinessLogic.ChiTietPhieuTTNCC.Select();
            if (tem == null)
                tem = new Entities.ChiTietPhieuTTNCC[0];
            return tem;
        }

        public static Entities.HoaDonNhap[] HoaDonNhap()
        {
            Entities.HoaDonNhap temp = new Entities.HoaDonNhap();
            temp.HanhDong = "1";
            temp.MaHoaDonNhap = "";
            
            Entities.HoaDonNhap[] tem = BusinessLogic.HoaDonNhap.SelectHoaDonNhap(temp);
            if (tem == null)
                tem = new Entities.HoaDonNhap[0];
            return tem;
        }

        public static Entities.ChiTietTraLaiNCC[] ChiTietTraLaiNCC()
        {
            Entities.ChiTietTraLaiNCC[] tem = BusinessLogic.ChiTietTraLaiNCC.Select();
            if (tem == null)
                tem = new Entities.ChiTietTraLaiNCC[0];
            return tem;
        }

        public static Entities.ChiTietHoaDonNhap[] ChiTietHoaDonNhap()
        {
            Entities.ChiTietHoaDonNhap temp = new Entities.ChiTietHoaDonNhap();
            temp.HanhDong = "1";
            temp.MaHoaDonNhap = "";
            temp.MaHangHoa = "";
            Entities.ChiTietHoaDonNhap[] tem = BusinessLogic.ChiTietHoaDonNhap.SelectChiTietHoaDonNhap(temp);
            if (tem == null)
                tem = new Entities.ChiTietHoaDonNhap[0];
            return tem;
        }

        public static Entities.SelectTongHopCongNo Select(string hanhDong)
        {
            if (hanhDong == "TongHopNCC")
            {
                Entities.SelectTongHopCongNo temp = new Entities.SelectTongHopCongNo();
                temp.HoaDonNhap = HoaDonNhap();
                temp.ChiTietPhieuTTNCC = ChiTietPhieuTTNCC();
                temp.PhieuTTNCC = PhieuTTNCC();
                temp.TraLaiNCC = TraLaiNCC();
                return temp;
            }
            if (hanhDong == "ChiTietNCC")
            {
                Entities.SelectTongHopCongNo temp = new Entities.SelectTongHopCongNo();
                temp.HoaDonNhap = HoaDonNhap();
                temp.ChiTietHoaDonNhap = ChiTietHoaDonNhap();
                temp.ChiTietPhieuTTNCC = ChiTietPhieuTTNCC();
                temp.ChiTietTraLaiNCC = ChiTietTraLaiNCC();
                temp.PhieuTTNCC = PhieuTTNCC();
                temp.TraLaiNCC = TraLaiNCC();
                return temp;
            }
            if (hanhDong == "CongNo")
            {
                Entities.SelectTongHopCongNo temp = new Entities.SelectTongHopCongNo();
                temp.ChiTietPhieuTTNCC = ChiTietPhieuTTNCC();
                temp.PhieuTTNCC = PhieuTTNCC();
                return temp;
            }
            return null;
        }
    }
}
#endregion